﻿<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>武汉理工大学计算机协会维修预约系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <script type="text/javascript" src="MyString.js"></script>

    <script type="text/javascript" src="XmlObject.js"></script>

    <script type="text/javascript" src="/js/jquery-1.10.2.min.js"></script>

    <link rel="stylesheet" type="text/css" href="default.css" />

    <script language="JavaScript" type="text/javascript">
        function checkInput() {
            var sdName = sName.value;
            var sdPhone = sPhone.value; //50
            var sdPlace = sPlace.value; //
            var sdSex = sex[sex.selectedIndex].value; //10
            var sdQueryCode = querycode.value;
            var sdDescribe = describe.value;
            if (checkLength(sdName, 50) == false) return false;
            if (checkLength(sdPhone, 50) == false) return false;
            if (checkLength(sdSex, 10) == false) return false;
            if (checkLength(sdName, 50) == false) return false;
        }
        function onSubmitClick() {
            checkInput();
            var sdName = sName.value;
            var sdPhone = sPhone.value; //50
            var sdPlace = sPlace.value; //
            var sdSex = sex[sex.selectedIndex].value; //10
            var sdQueryCode = querycode.value;
            var sdDescribe = describe.value;
            $.ajax({
                url: "thj.asp",
                data: {
                    Action: "new",
                    Name: sdName,
                    Phone: sdPhone,
                    Place: sdPlace,
                    Sex: sdSex,
                    QueryCode: sdQueryCode,
                    Describe: sdDescribe
                },
                success: function(data) {
                    var oData = eval("(" + data + ");");
                    if (oData.msg == 'ok') {
                        query_code.innerHTML = '<b>' + oData.code + '</b>';
                        fullmask.style.display = "block";
                        message.style.display = "block";
                    }
                    else {
                        alert("出现未知错误，请稍后重试！");
                    }
                }
            });
        }
        function checkLength(sText, nLenLimit) {
            if (sText.length > nLenLimit) return false;
            return true;
        }
        window.onload = function() {
            fullmask.style.display = "none";
            secBoard(1);
        }
        function closeDiv() {
            message.style.display = "none";
            window.location = "index.asp"
            return true;
        }
        function closeThisDiv() {
            PublicMsg.style.display = "none";
            return true;
        }
        function acceptRqt(nID) {
            $.ajax({
                url: "thj.asp",
                data: {
                    Action: "accept",
                    RequestID: nID
                },
                success: function(data) {
                    var oData = eval("(" + data + ");");
                    if (oData.msg == 'ok') {
                        setMessage("项目承接概况",
                        "同学姓名：<b>" + oData.name + "</b><br />" +
                        "&nbsp;&nbsp;&nbsp;&nbsp;联系电话：<b>" + oData.telphone + "</b><br />" +
                        "&nbsp;&nbsp;&nbsp;&nbsp;联系地址：<b>" + oData.location + "</b><br />" +
                        "&nbsp;&nbsp;&nbsp;&nbsp;故障描述：<b>" + oData.describe + "</b>"
                        , function() {
                            window.location = "index.asp";
                        });
                    }
                    else {
                        alert(oData.param);
                    }
                }
            });
        }
        var afterFunction;
        function setMessage(sTitle, sContent, afterClose) {
            p_msg_title.innerHTML = sTitle;
            p_msg_area.innerHTML = sContent;
            PublicMsg.style.display = "block";
            afterFunction = afterClose;
        }
        function closeMessage() {
            PublicMsg.style.display = "none";
            debugger;
            afterFunction();
            return true;
        }
        function secBoard(n) {
            var oRow = secTable.rows[0];
            for (i = 0; i < oRow.cells.length; i++)
                oRow.cells[i].className = "sec1";
            oRow.cells[n].className = "sec2";
            for (i = 0; i < mainTable.tBodies.length; i++)
                mainTable.tBodies[i].style.display = "none";
            mainTable.tBodies[n].style.display = "block";
        } 
    </script>

</head>
<body style="height: 100%;">
    <%if adminLogin=false and officerLogin=false then response.Redirect("index.asp")%>
    <div id="divTest" style="width: 99%; height: 98%; position: absolute;">
        <div class="fulldiv" id="fullmask">
        </div>
        <div class="msgdiv" id="PublicMsg">
            <span class="msg_title" id="p_msg_title"></span><span class="close_text" onclick="return closeMessage();">
                <a href="javascript:void(0);">[关闭]</a> </span><span class="msg_content" id="p_msg_area">
                </span>
        </div>
        <table class="frame_table">
            <tr style="height: 100%">
                <td class="left_side">
                    <table border="0" cellspacing="0" cellpadding="0" width="249" id="secTable">
                        <tr height="20" align="center">
                            <td class="sec1" width="10%" onclick="secBoard(0)">
                                已完成
                            </td>
                            <td class="sec2" width="10%" onclick="secBoard(1)">
                                未完成
                            </td>
                        </tr>
                    </table>
                    <table border="0" cellspacing="0" cellpadding="0" width="249" height="100%" id="mainTable"
                        class="main_tab">
                        <tbody style="display: block;">
                            <tr>
                                <td align="center" valign="top">
                                    <!--这里是已完成的一些 -->
                                    <div class="in_display">
                                        <%  dim ir
                                        dim sqlstr
                                        sqlstr=""
                                        set ir=Server.CreateObject("adodb.recordset")
                                        sqlstr="select s_accept.id as AID,s_request.sName as RName from s_request" & _ 
                                        " left join s_accept on s_accept.RequestID=s_request.id where s_accept.resp_boycode='" & Session("fix_usercode") & "' and s_request.state='done'"
                                        ir.open sqlstr,conn,3,3
                                        do while not ir.eof = true
                                        %>
                                        <a class="Text" href="view.asp?acceptid=<%=ir("AID") %>" target="myframe">
                                            <%=ir("RName") %></a><br />
                                        <%
                                            ir.movenext
                                        loop
                                        ir.close
                                        %>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                        <tbody style="display: none;">
                            <tr>
                                <td align="center" valign="top">
                                    <!--这里是未完成的一些 -->
                                    <div class="in_display">
                                        <%
                                        set ir=Server.CreateObject("adodb.recordset")
                                        ir.open "select s_accept.id as AID,s_request.sName as RName from s_request left join s_accept on s_accept.RequestID=s_request.id where s_accept.resp_boycode='" & Session("fix_usercode") & "' and s_request.state='taken'",conn,3,3
                                        do while not ir.eof = true
                                        %>
                                        <a class="Text" href="view.asp?acceptid=<%=ir("AID") %>" target="myframe">
                                            <%=ir("RName") %></a><br />
                                        <%
                                            ir.movenext
                                        loop
                                        ir.close
                                        set ir=nothing
                                        %>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td class="right_side">
                    <iframe frameborder="0" height="100%" width="100%" src="" id="myframe"></iframe>
                </td>
            </tr>
        </table>
        <%if adminLogin=true or officerLogin=true then %>
        <div class="topfloat">
            <a href="mylist.asp" class="btnClass">我承接的任务<%if getUndoneNum>0 then %><span style="color: Red;
                font-size: 13px;">[<%=getUndoneNum %>]</span><%end if %></a> <a href="index.asp"
                    class="btnClass">回主页</a>
        </div>
        <div class="makeup">
        </div>
        <%end if %>
    </div>
</body>
</html>
